﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/Admin.Master" AutoEventWireup="true" CodeBehind="ManagePages.aspx.cs" Inherits="MetadataBasedConfigArch.Web.Admin.ManagePages" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="MetadataBasedConfigArch.Web" Namespace="MetadataBasedConfigArch.Web.Controls" TagPrefix="CTXWeb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder" runat="server">
    <asp:LinkButton ID="AddLinkButton" CssClass="addbutton" runat="server" OnClick="AddLinkButton_Click">Add Page</asp:LinkButton>
    
    <div id="ShowPanel" runat="server">
        <div class="datagridcontainer">
            <%--<asp:GridView ID="MainGridView" runat="server" AutoGenerateColumns="false"  
                onrowdatabound="MainGridView_RowDataBound" 
                onrowcommand="MainGridView_RowCommand">
                <Columns>
                    <asp:BoundField  HeaderText="Name" DataField="Name"/>
                    <asp:TemplateField HeaderText="View">
                        <ItemTemplate>
                            <asp:HyperLink ID="PageHyperLink" runat="server">Open</asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>  
                    <asp:TemplateField HeaderText="Edit">
                        <ItemTemplate> 
                            <asp:Button ID="EditButton" runat="server" Text="Edit"  CommandName="EditD"/>
                            <asp:Button ID="DeleteButton" runat="server" Text="Delete"  CommandName="Delete"/>
                        </ItemTemplate> 
                    </asp:TemplateField> 
                </Columns>
            </asp:GridView> --%>
            <CTXWeb:CTXGridView ID="MainGridView"   runat="server" AutoGenerateColumns="false"  
                AutoGenerateExtendPropertiesColumn="true"  AutoGenerateColumnsAfter="11" 
                ExtendPropertiesDataField="ExtendProperties" 
                onrowdatabound="MainGridView_RowDataBound" 
                onrowcommand="MainGridView_RowCommand">
                <Columns>
                    <asp:BoundField  HeaderText="Name" DataField="Name"/>
                    <asp:TemplateField HeaderText="View">
                        <ItemTemplate>
                            <asp:HyperLink ID="PageHyperLink" runat="server">Open</asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>  
                    <asp:TemplateField HeaderText="Edit">
                        <ItemTemplate>  
                            <asp:Button ID="EditButton" runat="server" Text="Edit"  CommandName="EditD"/>
                            <asp:Button ID="DeleteButton" runat="server" Text="Delete"  CommandName="Delete"/>
                        </ItemTemplate> 
                    </asp:TemplateField>  
                </Columns>
            </CTXWeb:CTXGridView>
            <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
        </div>
    </div>
    <div id="EditPanel" runat="server" visible="false">
        <div id="EditInforDiv">
            Add a New Page</div>
        <div class="edit_field">
            <div class="edit_field_label">
                Name:
            </div>
            <div class="edit_field_input">
                <asp:TextBox ID="NameTextBox" runat="server"></asp:TextBox>
            </div>
        </div>
        <div class="edit_field">
            <div class="edit_field_label">
                Content:
            </div>
            <div class="edit_field_input">
                <telerik:RadEditor ID="ContentRadEditor" runat="server">
                </telerik:RadEditor>
            </div>
        </div>
        <asp:Repeater ID="ExtendPropertyRepeater" runat="server" 
            onitemdatabound="ExtendPropertyRepeater_ItemDataBound">
            <ItemTemplate>
                <div class="edit_field">
                    <div class="edit_field_label">
                        <asp:Label ID="Key" runat="server"></asp:Label>
                    </div>
                    <div class="edit_field_input">  
                        <asp:TextBox ID="Value" runat="server"></asp:TextBox>
                    </div>
                </div> 
            </ItemTemplate>
        </asp:Repeater>
        <div class="edit_field">
            <div class="edit_field_label">
                <asp:Button ID="SaveButton" runat="server" Text="Save" OnClick="SaveButton_Click" />
            </div>
            <div class="edit_field_input">
                <asp:Button ID="CancelButton" runat="server" Text="Cancel" OnClick="CancelButton_Click" />
            </div>
        </div>
    </div>
    <input type="hidden" id="PageIDHiddenInput" runat="server"/>
</asp:Content>
